package com.welsy.authoring.vo.course
{
	import com.welsy.authoring.business.TestQNames;
	import com.welsy.authoring.vo.CourseVO;
	import com.welsy.authoring.vo.course.pattern.CourseState;
	
	[Bindable]	
	public class TestVO
	{
	  public var testId:String = "0";
	  public var title:String = "";
	  public var skipType:String = "0";
	  public var questionWeightType:String = "0";
	  public var passingCondition:String = "0";
	  public var displayCorrected:String = "false";
	  public var displayFeedback:String = "false";
	  public var displayCorrectAnswere:String = "false";
	  public var traceConsultationTime:String = "false";
	  public var consultationTimeLimit:int = 0;
	  public var weight:int = 0;
      
      public function setProperties(list:XMLList):void {
  		this.testId = list.child(TestQNames.qnTestID);
    	this.title = list.child(TestQNames.qnTitle);
    	this.skipType = list.child(TestQNames.qnQuestionSkipType);
    	this.questionWeightType = list.child(TestQNames.qnQuestionWeightType);
    	this.passingCondition = list.child(TestQNames.qnPassingCondition);
    	this.displayCorrected = list.child(TestQNames.qnDisplayCorrected);
    	this.displayFeedback = list.child(TestQNames.qnDisplayFeedback);
    	this.displayCorrectAnswere = list.child(TestQNames.qnDisplayCorrectAnswer);
    	this.traceConsultationTime = list.child(TestQNames.qnTraceConsultationTime);
    	this.consultationTimeLimit = list.child(TestQNames.qnConsultationTimeLimit);
      }

      public function SkipQuestion():Boolean {
      	if (this.skipType == "0")
      		return true;
		else
			return false;
      } 
      
      public function DiplayFeedback():Boolean {
      	if (this.displayFeedback == "0" || this.displayFeedback == "true")
      		return true;
		else
			return false;
      }  
      
      public function RepeatQuestion():Boolean {
      	if (this.displayCorrectAnswere == "1" || this.displayCorrectAnswere == "true")
      		return true;
		else
			return false;
      } 
      
      public function TraceTime():Boolean {
      	if (this.traceConsultationTime == "0" || this.traceConsultationTime == "true")
      		return true;
		else
			return false;
      }
      
      public function enableItem(course:CourseVO,type:String):Boolean
	  {			
		if ((type == "0") && ((course.state == CourseState.publish) || (course.parentCourseId != "0")) )
			return false
		   else
		    return true
	  }
            
	}
}